package com.bokesoft.yigo.mid.service.example1;

import java.util.ArrayList;

import com.bokesoft.yigo.common.util.TypeConvertor;
import com.bokesoft.yigo.mid.base.DefaultContext;
import com.bokesoft.yigo.mid.connection.IDBManager;
import com.bokesoft.yigo.mid.service.IExtService;
import com.bokesoft.yigo.struct.datatable.DataTable;

public class QueryExample4ValueService implements IExtService {

	@Override
	public Object doCmd(DefaultContext context, ArrayList<Object> paras) throws Throwable {
		long oid = TypeConvertor.toLong(paras.get(0));
		IDBManager db = context.getDBManager();
		String sql = "select Value1 from Example4Head where OID=?";
		Object value = null;
		DataTable tbl = db.execPrepareQuery(sql, oid);
		if ( tbl.first() ) {
			value = tbl.getObject("Value1");
		}
		return value;
	}

}
